package com.zyh.homeworkzhuantike;

public class Test10 {
    public static void main(String[] args) {
        /*
        10.编程找出四位整数abcd中满足下述关系的数，(ab+cd)*(ab+cd)=abcd（例如：(20 + 25) (20 + 25)= 2025），并统计满足条件的数的个数，求出所有满足条件的数的和。
         */
        int a = 0, b = 0, c = 0, d = 0, sum = 0, count = 0;
        for (int i = 1000; i < 10000; i++) {
            int ab = i / 100;
            int cd = i % 100;
            if (Math.pow((ab + cd), 2) == i) {
                System.out.println(i+" ");
                sum += i;
                count++;
            }
        }
        System.out.println();
        System.out.println("共有" + count + "个");
        System.out.println("sum:" + sum);
    }
}
